﻿using System;
using System.Linq;
using System.Windows.Controls;
using System.Windows;
using UBCon.Ribbon.Interfaces;
using System.Collections.ObjectModel;
using UBCon.Ribbon.Models;
using System.Windows.Media.Animation;
using System.Windows.Media;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Collections.Specialized;
using System.Windows.Markup;
using UBCon.Core;

namespace UBCon.Ribbon
{
    [TemplatePart(Name = PART_RootGridName, Type=typeof(Grid))]
    [TemplatePart(Name = PART_HiddenGridName, Type=typeof(Grid))]
    [TemplatePart(Name = PART_DropDownButtonName, Type=typeof(RibbonDropDownButton))]
    [TemplatePart(Name = PART_HiddenPopupName, Type=typeof(Popup))]
    [TemplatePart(Name=PART_HiddenToggleName, Type=typeof(ToggleButton))]
    [TemplatePart(Name = PART_PlaceAboveMenuItemName, Type = typeof(DropDownMenuItem))]
    [TemplatePart(Name = PART_PlaceBelowMenuItemName, Type = typeof(DropDownMenuItem))]
    internal class QAToolbar : Control, IRibbonControl, IAddChild
    {
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
        #region Constructors

        /// <summary>
        /// Default static constructor.
        /// </summary>
        static QAToolbar() 
        {
            Type ownerType = typeof(QAToolbar);
            DefaultStyleKeyProperty.OverrideMetadata(ownerType, new FrameworkPropertyMetadata(ownerType));
        }

        /// <summary>
        /// Initializes a new instance of the UBCon.Ribbon.QAToolbar class.
        /// </summary>
        internal QAToolbar() 
        {
            Items = new ObservableCollection<QAToolBarItemModel>();
            Items.CollectionChanged += OnItemsCollectionChanged;

            RemovedItems = new ObservableCollection<QAToolBarItemModel>();
            RemovedItems.CollectionChanged += OnRemovedItemsCollectionChanged;

            CheckableItems = new ObservableCollection<QAToolBarItemModel>();

            Loaded += OnQAToolbarLoaded;

        }
        #endregion

        //------------------------------------------------------
        //
        //  Properties
        //
        //------------------------------------------------------
        #region Properties

        /// <summary>
        /// Gets or sets reference to the UBCon.Ribbon.RibbonWindow object that hosts the content tree
        /// within which the dependency object is located.
        /// </summary>
        internal RibbonWindow RibbonWindow
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the collection used to generate the content of UBCon.Ribbon.QAToolbar.
        /// </summary>
        internal ObservableCollection<QAToolBarItemModel> Items
        {
            get { return (ObservableCollection<QAToolBarItemModel>)GetValue(ItemsProperty); }
            set { SetValue(ItemsProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.Items dependency property.
        /// </summary>
        internal static readonly DependencyProperty ItemsProperty =
            DependencyProperty.Register("Items", typeof(ObservableCollection<QAToolBarItemModel>), typeof(QAToolbar),
            new PropertyMetadata((ObservableCollection<QAToolBarItemModel>)null));

        /// <summary>
        /// Gets or sets the collection used to generate the hidden content of UBCon.Ribbon.QAToolbar.
        /// </summary>
        internal ObservableCollection<QAToolBarItemModel> RemovedItems
        {
            get { return (ObservableCollection<QAToolBarItemModel>)GetValue(RemovedItemsProperty); }
            set { SetValue(RemovedItemsProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.RemovedItems dependency property.
        /// </summary>
        internal static readonly DependencyProperty RemovedItemsProperty =
            DependencyProperty.Register("RemovedItems", typeof(ObservableCollection<QAToolBarItemModel>), typeof(QAToolbar),
            new PropertyMetadata((ObservableCollection<QAToolBarItemModel>)null));

        /// <summary>
        /// Gets or sets the collection used to generate the checkable item content of UBCon.Ribbon.QAToolbar.
        /// </summary>
        internal ObservableCollection<QAToolBarItemModel> CheckableItems
        {
            get { return (ObservableCollection<QAToolBarItemModel>)GetValue(CheckableItemsProperty); }
            set { SetValue(CheckableItemsProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.CheckableItems dependency property.
        /// </summary>
        internal static readonly DependencyProperty CheckableItemsProperty =
            DependencyProperty.Register("CheckableItems", typeof(ObservableCollection<QAToolBarItemModel>), typeof(QAToolbar),
            new PropertyMetadata((ObservableCollection<QAToolBarItemModel>)null));

        /// <summary>
        /// Gets or sets a boolean value indicating whether QAToolBar has collapsed items or not.
        /// </summary>
        internal bool HasRemovedItems
        {
            get { return (bool)GetValue(HasRemovedItemsProperty); }
            set { SetValue(HasRemovedItemsProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.HasRemovedItems dependency property.
        /// </summary>
        internal static readonly DependencyProperty HasRemovedItemsProperty =
            DependencyProperty.Register("HasRemovedItems", typeof(bool), typeof(QAToolbar),
            new PropertyMetadata(false, new PropertyChangedCallback(OnHasRemovedItemsChanged)));

        /// <summary>
        /// Gets or sets a boolean value indicating whether QAToolBar has items or not.
        /// </summary>
        internal bool HasItems
        {
            get { return (bool)GetValue(HasItemsProperty); }
            set { SetValue(HasItemsProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.HasItems dependency property.
        /// </summary>
        internal static readonly DependencyProperty HasItemsProperty =
            DependencyProperty.Register("HasItems", typeof(bool), typeof(QAToolbar), new PropertyMetadata(false));

        /// <summary>
        /// Gets or sets a boolean value which indicates whether QAToolbar contol has visible items or not.
        /// This is a dependency property.
        /// </summary>
        internal bool HasValidItems
        {
            get { return (bool)GetValue(HasValidItemsProperty); }
            set { SetValue(HasValidItemsProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.HasValidItems dependency property.
        /// </summary>
        internal static readonly DependencyProperty HasValidItemsProperty =
            DependencyProperty.Register("HasValidItems", typeof(bool), typeof(QAToolbar), new PropertyMetadata(true));

        
        /// <summary>
        /// Gets or sets a boolean value which indicates whether hidden drop-down for QAToolbar is currently open or not.
        /// This is a dependency property.
        /// </summary>
        internal bool IsHiddenDropDownOpen
        {
            get { return (bool)GetValue(IsHiddenDropDownOpenProperty); }
            set { SetValue(IsHiddenDropDownOpenProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.IsHiddenDropDownOpen dependency property.
        /// </summary>
        internal static readonly DependencyProperty IsHiddenDropDownOpenProperty =
            DependencyProperty.Register("IsHiddenDropDownOpen", typeof(bool), typeof(QAToolbar),
            new PropertyMetadata(false, new PropertyChangedCallback(OnIsHiddenDropDownOpenChanged)));

        /// <summary>
        /// Gets a boolean value which indicates whether hidden drop down content can be animated or not.
        /// </summary>
        internal bool HiddenPopupContentCanBeAnimated
        {
            get
            {
                return _hiddenPopup != null
                        && _hiddenPopup.Child != null
                            && _hiddenPopup.Child is FrameworkElement
                            && _hiddenPopup.Child.RenderTransform is TranslateTransform;
            }
        }

        /// <summary>
        /// Gets or sets a boolean value indicating whether QAToolbar control is located above the RibbonBar or not.
        /// This is a dependency property.
        /// </summary>
        public bool? IsAboveRibbon
        {
            get { return (bool?)GetValue(IsAboveRibbonProperty); }
            set { SetValue(IsAboveRibbonProperty, value); }
        }

        /// <summary>
        /// Identifies the UBCon.Ribbon.QAToolbar.IsAboveRibbon dependency property.
        /// </summary>
        public static readonly DependencyProperty IsAboveRibbonProperty =
            DependencyProperty.Register("IsAboveRibbon", typeof(bool?), typeof(QAToolbar), new PropertyMetadata((bool?)null));

        #endregion

        //------------------------------------------------------
        //
        //  Depenency Property Changed Callbacks
        //
        //------------------------------------------------------
        #region Depenency Property Changed Callbacks

        /// <summary>
        /// Invoked when IsHiddenDropDownOpen property changes.
        /// </summary>
        /// <param name="sender">Type: System.Windows.DependencyObject. The DependencyObject on which the property has changed value.</param>
        /// <param name="e">Type: System.Windows.DependencyPropertyChangedEventArgs. Event data that is issued by any event that tracks changes to the effective value of this property.</param>
        private static void OnIsHiddenDropDownOpenChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 
        {
            QAToolbar toolBar = (QAToolbar)sender;
            bool newValue = (bool)e.NewValue;
            bool oldValue = !newValue;
            if (newValue)
            {
                toolBar.TryAnimateDropDownContent();
            }
            else
            {
                if (Mouse.Captured != null)
                {
                    Mouse.Capture(null);
                }
                toolBar.RestoreContent();

            }
        }

        /// <summary>
        /// Invoked when HasRemovedItems property changes.
        /// </summary>
        /// <param name="sender">Type: System.Windows.DependencyObject. The DependencyObject on which the property has changed value.</param>
        /// <param name="e">Type: System.Windows.DependencyPropertyChangedEventArgs. Event data that is issued by any event that tracks changes to the effective value of this property.</param>
        private static void OnHasRemovedItemsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) 
        {
            QAToolbar toolBar = sender as QAToolbar;
            if (toolBar.IsLoaded) 
            {
                if (toolBar._rootGrid != null && toolBar._hiddenGrid != null) 
                {
                    bool newValue = (bool)e.NewValue;
                    if (newValue)
                    {
                        toolBar.RearrangeDropDownButton();
                    }
                    else 
                    {
                        toolBar.RearrangeDropDownButton(true);
                    }
                }
            }
        }
        
        #endregion

        //------------------------------------------------------
        //
        //  Overrides
        //
        //------------------------------------------------------
        #region Overrides

        /// <summary>
        /// Invoked when control's render size changes.
        /// </summary>
        /// <param name="sizeInfo">Type: System.Windows.SizeChangedInfo. Report the specifics of the value 
        /// change involving a System.Windwos.Size.</param>
        protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
        {
            base.OnRenderSizeChanged(sizeInfo);
            if (sizeInfo.WidthChanged && 
                RibbonWindow != null && 
                !RibbonWindow.updatingTitleLocation) 
            {
                RibbonWindow.UpdateTitleLocation(RibbonWindow);
            }
        }

        /// <summary>
        /// When overridden in a derived class, is invoked whenever application 
        /// code or internal processes call ApplyTemplate.
        /// </summary>
        public override void OnApplyTemplate()
        {
            if (placeAboveMenuItem != null && placeBelowMenuItem != null)
            {
                placeAboveMenuItem.Click -= OnRearrangeQAToolbarRequested;
                placeBelowMenuItem.Click -= OnRearrangeQAToolbarRequested;
            }

            _rootGrid = GetTemplateChild(PART_RootGridName) as Grid;

            _hiddenGrid = GetTemplateChild(PART_HiddenGridName) as Grid;
            
            if (_hiddenGrid == null) 
            {
                throw new NullReferenceException(PART_HiddenGridName);
            }

            dropButton = GetTemplateChild(PART_DropDownButtonName) as RibbonDropDownButton;

            if (dropButton == null) 
            {
                throw new NullReferenceException(PART_DropDownButtonName);
            }

            if (_hiddenPopup != null) 
            {
                _hiddenPopup.Closed -= OnHiddenPopupClosed;
            }

            _hiddenPopup = GetTemplateChild(PART_HiddenPopupName) as Popup;

            if (_hiddenPopup == null) 
            {
                throw new NullReferenceException(PART_HiddenPopupName);
            }
            _toggleButton = GetTemplateChild(PART_HiddenToggleName) as ToggleButton;

            _hiddenPopup.Closed += OnHiddenPopupClosed;

            _itemsHost = GetTemplateChild(PART_ItemsHostName) as StackPanel;

            _hiddenItemsHost = GetTemplateChild(PART_HiddenItemsHostName) as StackPanel;

            placeAboveMenuItem = GetTemplateChild(PART_PlaceAboveMenuItemName) as DropDownMenuItem;

            placeBelowMenuItem = GetTemplateChild(PART_PlaceBelowMenuItemName) as DropDownMenuItem;
            if (_itemsHost == null || _hiddenItemsHost == null)
            {
                throw new NullReferenceException(PART_HiddenItemsHostName + " " + PART_ItemsHostName);
            }

            if (placeAboveMenuItem != null && placeBelowMenuItem != null) 
            {
                placeAboveMenuItem.Click += OnRearrangeQAToolbarRequested;
                placeBelowMenuItem.Click += OnRearrangeQAToolbarRequested;
            }

            base.OnApplyTemplate();
        }

        #endregion

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
        #region Internal Methods

        /// <summary>
        /// Places QAToolbar above the RibbonBar if isAbove parameter's value is true, below otherwise.
        /// </summary>
        internal void OnRearrangeQAToolbarRequested(object sender, RoutedEventArgs e) 
        {
            e.Handled = true;
            bool isAbove = sender == placeAboveMenuItem ? true : false;
            RibbonWindow window = this.RibbonWindow;
            if (window != null && window.InternalRibbonBar != null)
            {
                SetValue(QAToolbar.IsAboveRibbonProperty, isAbove);
                window.InternalRibbonBar.RearrangeQAToolbar(isAbove);
            }
        }

        /// <summary>
        /// Removes the control from hidden panel.
        /// </summary>
        internal void RemoveNextFromHiddenPanel() 
        {
            if (RemovedItems.Count > 0) 
            {
                QAToolBarItemModel model = RemovedItems[0];
                model.IsValid = true;
                RemovedItems.Remove(model);
                _hiddenItemsHost.Children.Remove(model.UIElement);
                _itemsHost.Children.Add(model.UIElement);
            }
        }

        /// <summary>
        /// Inserts the control to hidden panel.
        /// </summary>
        internal void InsertNextToHiddenPanel() 
        {
            if (Items.Count > 0 && HasValidItems)
            {
                int index = -1;
                QAToolBarItemModel model = null;

                if (RemovedItems.Count > 0)
                {
                    model = RemovedItems[0];
                    index = Items.IndexOf(model);
                    index--;
                }
                else
                {
                    index = Items.Count - 1;
                }
                if (index >= 0)
                {
                    model = Items[index];
                }
                if (model != null)
                {
                    model.IsValid = false;
                    RemovedItems.Insert(0, model);
                    
                    _itemsHost.Children.Remove(model.UIElement);
                    _hiddenItemsHost.Children.Insert(0, model.UIElement);

                 
                }
            }
           
        }

        /// <summary>
        /// Gets the last valid control's width.
        /// </summary>
        internal double GetLastValidItemWidth() 
        {
            int index = -1;
            double width = 0.0D;
            QAToolBarItemModel model = null;
            if (RemovedItems.Count > 0)
            {
                model = RemovedItems[0];
                index = Items.IndexOf(model);
                index--;
            }
            else 
            {
                index = Items.Count - 1;
            }
            if (index >= 0) 
            {
                model = Items[index];
                width = model.UIElement.DesiredSize.Width;
            }
            return width;
        }

        /// <summary>
        /// Gets the last hidden control's width.
        /// </summary>
        internal double GetLastHiddenItemWidth()
        {
            double width = 0.0D;
            QAToolBarItemModel model = null;
            if (RemovedItems.Count > 0)
            {
                model = RemovedItems[0];
                width = model.UIElement.DesiredSize.Width;
            }
            return width;
        }

        /// <summary>
        /// Invoked by owner window when RibbonWindow.Text attached property changes.
        /// </summary>
        internal void OnTextChanged(UIElement sender, string newValue) 
        {
            if (sender != null) 
            {
                bool shouldRemove = string.IsNullOrEmpty(newValue);

                QAToolBarItemModel model = (from m in Items where m.UIElement == sender select m).FirstOrDefault();
                if (model == null)
                {
                    model = (from m in RemovedItems where m.UIElement == sender select m).FirstOrDefault();
                }
                
                if (model != null) 
                {
                    if (shouldRemove)
                    {
                        CheckableItems.Remove(model);
                    }
                    else 
                    {
                        model.Text = newValue;
                        if (!CheckableItems.Contains(model))
                        {
                            CheckableItems.Add(model);
                        }
                    }
                }
            }
        }
        #endregion

        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------
        #region Private Methods

        /// <summary>
        /// Tries to open hidden popup with animation.
        /// </summary>
        private void TryAnimateDropDownContent()
        {
            if (HiddenPopupContentCanBeAnimated)
            {
                if (ShowContentStoryboard == null)
                {
                    DoubleAnimation da = new DoubleAnimation() 
                    { 
                        EasingFunction = new ExponentialEase() 
                        { 
                            EasingMode = EasingMode.EaseOut, 
                            Exponent = 5 
                        } 
                    };

                    TranslateTransform transform = _hiddenPopup.Child.RenderTransform as TranslateTransform;
                    Storyboard.SetTargetProperty(da, new PropertyPath(Constants.YPropertyPath));
                    Storyboard.SetTarget(da, _hiddenPopup.Child as FrameworkElement);
                    ShowContentStoryboard = new Storyboard();
                    da.From = -5D;
                    da.To = 0.0D;
                    da.Duration = new Duration(TimeSpan.FromSeconds(0.30));
                    ShowContentStoryboard.Children.Add(da);
                }
                ShowContentStoryboard.Begin();
            }
        }

        /// <summary>
        /// Closes hidden popup with animation.
        /// </summary>
        private void RestoreContent()
        {
            if (HideContentStoryboard == null)
            {
                HideContentStoryboard = new Storyboard();
                DoubleAnimation da = new DoubleAnimation();
                Storyboard.SetTargetProperty(da, new PropertyPath(Constants.YPropertyPath));
                Storyboard.SetTarget(da, _hiddenPopup.Child as FrameworkElement);
                da.From = 0.0D;
                da.To = -5;
                da.Duration = new Duration(TimeSpan.FromSeconds(0.02));
                HideContentStoryboard.Children.Add(da);
            }
            HideContentStoryboard.Begin();
        }

        /// <summary>
        /// Removes drop-down button from main grid and inserts into hidden 
        /// grid and vice-versa if isRollback is true.
        /// </summary>
        private void RearrangeDropDownButton(bool isRollback=false) 
        {
            if (_rootGrid != null && _hiddenGrid != null) 
            {
                if (isRollback)
                {
                    _hiddenGrid.Children.Remove(dropButton);
                    _rootGrid.Children.Add(dropButton);
                }
                else 
                {
                    _rootGrid.Children.Remove(dropButton);
                    _hiddenGrid.Children.Add(dropButton);
                }
            }
        }

        /// <summary>
        /// Invoked when menu item is checked.
        /// </summary>
        internal void OnItemChecked(QAToolBarItemModel model) 
        {
            model.IsVisible = !model.IsVisible;
            SetValue(IsHiddenDropDownOpenProperty, false);
        }
        #endregion

        //------------------------------------------------------
        //
        //  Event Handlers
        //
        //------------------------------------------------------
        #region Event Handlers

        /// <summary>
        /// Occurs when the element is laid out, rendered, and ready for interaction. 
        /// (Inherited from FrameworkElement.)
        /// </summary>
        /// <param name="sender">Owner of the event.</param>
        /// <param name="e">Event data for the event.</param>
        private void OnQAToolbarLoaded(object sender, RoutedEventArgs e) 
        {
            Loaded -= OnQAToolbarLoaded;

            foreach (QAToolBarItemModel model in Items)
            {
                if (!_itemsHost.Children.Contains(model.UIElement))
                {
                    _itemsHost.Children.Add(model.UIElement);
                }
            }
            if (HasRemovedItems)
            {
                RearrangeDropDownButton();
            }
        }

        /// <summary>
        /// Invoked when Popup's IsOpen property is set to false.
        /// </summary>
        /// <param name="sender">Owner of the event.</param>
        /// <param name="e">Event data for the event.</param>
        private void OnHiddenPopupClosed(object sender, EventArgs e) 
        {
            _toggleButton.SetValue(ToggleButton.IsCheckedProperty, false);
        }

        /// <summary>
        /// Invoked when item is added, removed, changed, moved, or the entire collection is refreshed.
        /// </summary>
        private void OnItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 
        {
            SetValue(HasItemsProperty, Items.Count > 0);
        }

        /// <summary>
        /// Invoked when item is added, removed, changed, moved, or the entire collection is refreshed.
        /// </summary>
        private void OnRemovedItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) 
        {
            SetValue(HasRemovedItemsProperty, RemovedItems.Count > 0);

            SetValue(HasValidItemsProperty, RemovedItems.Count != Items.Count);
        }
        #endregion

        //------------------------------------------------------
        //
        //  Fields
        //
        //------------------------------------------------------
        #region Fields

        private Grid 
            //Root visual control
            _rootGrid, 
            //hidden drop-down's root control
            _hiddenGrid;

        private const string PART_RootGridName = "PART_Root",
                             PART_HiddenGridName = "PART_HiddenGrid",
                             PART_DropDownButtonName = "PART_DropDownButton",
                             PART_HiddenPopupName = "PART_HiddenPopup",
                             PART_HiddenToggleName = "PART_HiddenToggle",
                             PART_ItemsHostName = "PART_ItemsHost",
                             PART_HiddenItemsHostName = "PART_HiddenItemsHost",
                             PART_PlaceAboveMenuItemName = "PART_PlaceAboveMenuItem",
                             PART_PlaceBelowMenuItemName = "PART_PlaceBelowMenuItem";
        private StackPanel _itemsHost, _hiddenItemsHost;
        private RibbonDropDownButton dropButton;
        private DropDownMenuItem placeAboveMenuItem, placeBelowMenuItem;
        private Popup _hiddenPopup;

        private Storyboard
            // Storyboard used to open hidden popup with animation.
             ShowContentStoryboard,
            // Storyboard used to close hidden popup with animation.
             HideContentStoryboard;

        private ToggleButton _toggleButton;
        #endregion

        //------------------------------------------------------
        //
        //  Events
        //
        //------------------------------------------------------
        #region Events
        #endregion

        //------------------------------------------------------
        //
        //  Commands
        //
        //------------------------------------------------------
        #region Commands

       
        #endregion

        //------------------------------------------------------
        //
        //  IAddChild
        //
        //------------------------------------------------------
        #region IAddChild

        /// <summary>
        /// Adds a child object.
        /// </summary>
        /// <param name="value">The child object to add.</param>
        public void AddChild(object value) 
        {
            if (value != null && value is UIElement) 
            {
                UIElement newItem = value as UIElement;
                QAToolBarItemModel exists = (from m in Items where m.UIElement == newItem select m).FirstOrDefault();
                if (exists == null) 
                {
                    string itemText = (string)newItem.GetValue(RibbonWindow.TextProperty);

                    QAToolBarItemModel model = new QAToolBarItemModel()
                    {
                        UIElement = newItem,
                        Text = itemText
                    };

                    Items.Add(model);

                    if (RemovedItems.Count > 0)
                    {
                        RemovedItems.Add(model);
                    }

                    if (!string.IsNullOrEmpty(itemText)) 
                    {
                        CheckableItems.Add(model);
                    }
                }

            }
        }

        /// <summary>
        /// Adds a child text.
        /// </summary>
        /// <param name="value">The child string to add.</param>
        public void AddText(string value) { }

        #endregion

        //------------------------------------------------------
        //
        //  IRibbonControl Implementation
        //
        //------------------------------------------------------
        #region IRibbonControl Implementation

        /// <summary>
        /// Gets a boolean value indicating whether the contol's size is large
        /// </summary>
        public bool IsLarge
        {
            get { return true; }
        }

        #endregion
    }
}
